<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 产品管理</title>
	<%@include file="/WEB-INF/jsp/include/meta.jsp"%>
	
	<link href="css/public.css" rel="stylesheet" type="text/css">
	<link href="css/index.css" rel="stylesheet" type="text/css">
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar.js"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/productService.js"></script>
	
	<script type="text/javascript">
	function beforeSubmit(){			
		var productName=$("name").value;
		var productNo=$("productNo").value;
		if(""==productName){alert("产品名称不能为空!");return false;}
		if(""==productNo){alert("请填写产品货号");return false;}
		if(productNo.length>100){alert("货号长度不能超过100个字");return false;}
		//if($N("unit")[0].value.length>50){alert("计量单位不能操作50个字");return false;}
		//if($N("details")[0].value.length>300){alert("船方自购物料不能操作300个字");return false;}
		//if($N("remark")[0].value.length>300){alert("备注不能操作300个字");return false;}
		
		//window.parent.loading(true);
			
		return true;
	}
		
	</script>
</head>

<body>
<form:form action="" method="post" name="myform" enctype="multipart/form-data" onsubmit="return beforeSubmit();">
<table class="tabView" style="margin-top:5px">
	<tr><th width="100">产品名称：</th><td><input type="text" name="name" id="name" value="${command.name}" maxlength="100" class="input"/>
			<input type="hidden" name="productId0" id="product_id" value="${command.id}" /></td>
		<th width="100">货号：</th><td><input type="text" name="productNo" id="productNo" value="${command.productNo}" maxlength="30"/></td>
		<th>常规材质：</th><td><input type="text" name="material" id="material" value="${command.material}" maxlength="200"/></td>
	</tr>
	
	<tr>		
		<th>是否需要商检：</th><td>
				<form:select path="inspection">
					<form:option value="false" label="否"/>
					<form:option value="true" label="是"/>
				</form:select>
		<th>海关编码：</th><td><input type="text" name="customsCode" id="customsCode" value="${command.customsCode}" maxlength="30"/></td>
			<th>退税率：</th><td><input type="text" name="taxTate" id="taxTate" value="${command.taxTate}" maxlength="30"/></td></tr>
	<tr>
    	<th rowspan="3">指导价格：</th>
    	<td colspan="5" align="center">相应数量对应价格</td>
  	</tr>
		  <tr>
		    <td><input type="text" name="guideNum1" id="guideNum1" value="${command.guideNum1}" maxlength="20"/></td>
		    <td><input type="text" name="guideNum2" id="guideNum2" value="${command.guideNum2}" maxlength="20"/></td>
		    <td><input type="text" name="guideNum3" id="guideNum3" value="${command.guideNum3}" maxlength="20"/></td>
		    <td><input type="text" name="guideNum4" id="guideNum4" value="${command.guideNum4}" maxlength="20"/></td>
		    <td><input type="text" name="guideNum5" id="guideNum5" value="${command.guideNum5}" maxlength="20"/></td>
		  </tr>
		  <tr>
		    <td><input type="text" name="guidePrice1" id="guidePrice1" value="${command.guidePrice1}" maxlength="20"/></td>
		    <td><input type="text" name="guidePrice2" id="guidePrice2" value="${command.guidePrice2}" maxlength="20"/></td>
		    <td><input type="text" name="guidePrice3" id="guidePrice3" value="${command.guidePrice3}" maxlength="20"/></td>
		    <td><input type="text" name="guidePrice4" id="guidePrice4" value="${command.guidePrice4}" maxlength="20"/></td>
		    <td><input type="text" name="guidePrice5" id="guidePrice5" value="${command.guidePrice5}" maxlength="20"/></td>
		  </tr>
			
		<tr><th>产品图片：</th><td colspan="5">
			<c:choose>
				<c:when test="${not empty command.imageUri}">
					<a href="<%=basePath%>${command.imageUri}" target="_blank">
						<img src="<%=basePath%>${command.imageUri}" border="1" style="width:100px;height:100px;" alt="点击查看原图"/></a>
					<a href="javascript:void(0)" onclick="delImage('${command.id}')">删除图片</a>
				</c:when>
				<c:otherwise>
					<input type="file" id="productImage" name="productImage" size="32"/>
				</c:otherwise>
			</c:choose>				
			</td></tr>
			
		<tr><th>申报要素：</th><td colspan="5"><textarea name="declarationElements" id="declarationElements" rows="3" cols="100" maxlength='200'>${command.declarationElements}</textarea></td></tr>
		<tr><th>描述：          </th><td colspan="5"><textarea name="detail"              id="detail"              rows="3" cols="100" maxlength='200'>${command.detail}             </textarea></td></tr>
		<tr><th>备注：</th><td colspan="5"><textarea name="remark" id="remark" rows="3" cols="100" maxlength='200'>${command.remark}</textarea></td></tr>		
		<tr><td colspan="3" style="text-align:right;height:"><input type="submit" value=" 提 交 " class="btn1" /></td>
			<td colspan="3" style="text-align:left;height:"><input type="reset" value=" 重置 " class="btn1" value="reset"/></td>
		</tr>
		
</table>
</form:form>
<script type="text/javascript">
//window.parent.loading(false);

function delImage(id){
	if(null==id||''==id){
		alert('无法获取图片信息,请重新刷新信息！');return;
	}
	if(confirm("删除产品图片 ？")){
		productService.deleteImage(id,{
			callback:function(f){alert("删除成功");reload();},
			exceptionHandler:function(message){reload();alert("删除失败，请重试");},
			errorHander:function(err){}
		})
	}
}
$(limit_textarea_input)
</script>
</body>
</html>
